/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package service.Impl;

import dao.*;
import dao.Impl.*;
import entity.*;
import entity.Petowner;
import java.util.List;
import service.OwnerService;

/**
 *实现主人功能
 * @author ZZ
 */
public class OwnerServiceImpl implements OwnerService{

    @Override
    public void buy(Pet pet) {
        
    }

    @Override
    public void sell(Pet pet) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public boolean login(String name, String password) {
        OwnerDao ownerDao= new OwnerDaoImpl();
        List<Petowner> child;
        child=ownerDao.select();
        for (Petowner children : child) {
            if(children.getName().equals(name) && children.getPassword().equals(password))
            {
                return true;
            }
        }
        return false;
    }
}
